package com.ssy.lingxi.transaction.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 商品确认报价-操作枚举类
 *
 * @author wrc
 * @date 2020/11/18
 */
public enum ConfirmQuoteOperationEnum {

    ACCEPT_QUOTE(1, "接受报价"),
    AGREE(2, "同意"),
    SUBMIT_CHECK_QUOTE(3, "提交审核报价单"),
    CHECK_QUOTE(4, "审批询价报价单"),
    CHECK_QUOTE_1(5, "审核报价单(一级)"),
    CHECK_QUOTE_2(6, "审核报价单(二级)"),
    CONFIRM_QUOTE(7, "确认报价单"),
    ;
    /**
     * 状态
     */
    private Integer state;


    /**
     * 描述
     */
    private String name;

    public static String getName(Integer state){
        ConfirmQuoteOperationEnum workEnum = Arrays.stream(ConfirmQuoteOperationEnum.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(ConfirmQuoteOperationEnum.class, workEnum.getState());
    }

    ConfirmQuoteOperationEnum(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public void setName(String name) {
        this.name = name;
    }

}
